package cc.vicp.djx314.msing.web.form;

import java.util.ArrayList;

public class AutoInitArrayList < T > extends ArrayList < T > {
	private static final long serialVersionUID = 1L;

	private Class < T > t = null ;

	public AutoInitArrayList(Class < T > t) {
		this .t = t;
	}

	@Override
	public T get( int index) {
		try {
			while (index >= size()) {
				add(t.newInstance());
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return super .get(index);
	}
}